/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.terminalrodoviario;

import java.security.MessageDigest;

/**
 *
 * @author TIAGO
 */
public class Encryption {

    public String encrypt(String pass){
        String senha = pass;
        try {
            MessageDigest algorithm = MessageDigest.getInstance("MD5");
            byte messageDigest[] = algorithm.digest(pass.getBytes("UTF-8"));
            StringBuilder hexString = new StringBuilder();
            for (byte b : messageDigest) {
                    hexString.append(String.format("%02X", 0xFF & b));
            }
            senha = hexString.toString();
            return senha;
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return senha;
    }

}
